package org.example.registry;

import org.example.model.ServiceMetaInfo;

import java.util.List;

/**
 * @Title: RegistryServiceCache
 * @Author: kunliangzhao
 * @Package org.example.registry
 * @Date: 2025/6/13 13:38
 * @Description: 注册中心本地缓存
 */
public class RegistryServiceCache {

    /**
     * 服务缓存
     */
    List<ServiceMetaInfo> serviceCache;

    /**
     * 写入缓存
     * @param newServiceCache
     */
    void writeCache(List<ServiceMetaInfo> newServiceCache){
        this.serviceCache = newServiceCache;
    }

    /**
     * 读取缓存
     * @return
     */
    List<ServiceMetaInfo> readCache(){
        return this.serviceCache;
    }

    /**
     * 清空缓存
     */
    void clearCache(){
        this.serviceCache = null;
    }
}
